package com.source.diyjuc;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.AbstractQueuedLongSynchronizer;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;

/**
 * @Author wengqy
 * @Date 2021/1/17
 */
public class MyLock implements Lock {

    private  DiyLock diyLock = new DiyLock();
    static class  DiyLock extends AbstractQueuedLongSynchronizer{
         protected DiyLock(){
           super();
         }

        @Override
        protected boolean tryAcquire(long arg) {

           getState();
           compareAndSetState(1,3);
           getExclusiveOwnerThread();
            return super.tryAcquire(arg);
        }
    }




    @Override
    public void lock() {

    }

    @Override
    public void lockInterruptibly() throws InterruptedException {

    }

    @Override
    public boolean tryLock() {
        return false;
    }

    @Override
    public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
        return false;
    }

    @Override
    public void unlock() {

    }

    @Override
    public Condition newCondition() {
        return null;
    }
}
